<HTML><HEAD><TITLE>succ(?X, ?Y)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Arithmetic</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>succ(?X, ?Y)</H1>
Successor relation over natural numbers.
<DL>
<DT><EM>X</EM></DT>
<DD>an integer or a variable
</DD>
<DT><EM>Y</EM></DT>
<DD>an integer or a variable
</DD>
</DL>
<H2>Description</H2>
   Successor relation over natural numbers.  Succeeds if X is an
   integer greater or equal to zero, and Y is one greater than X.
   If one of the arguments is uninstantiated, it gets computed from
   the other by adding or subtracting 1, respectively.
<P>
   If the system is in coroutining mode and both arguments are
   uninstantiated, succ/2 delays until at least one argument is known.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>succ(+, -) is semidet
<LI>succ(-, +) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if X or Y are negative integers, or if Y is 0
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>an argument is a non-integer number
<DT><EM>(4) instantiation fault </EM>
<DD>both arguments are uninstantiated (non-coroutining mode only)
<DT><EM>(24) number expected </EM>
<DD>X or Y is not a number
</DL>
<H2>Examples</H2>
<PRE>
   Success:
   	succ(0, 1).
   	succ(7, 8).
   	succ(10000000000000000000, 10000000000000000001).
   	succ(0, Y).		(gives Y=1)
   	succ(X, 3).		(gives X=2)

   Fail:
   	succ(X, 0).
   	succ(X, -5).
   	succ(-1, Y).

   Error:
   	succ(X, Y).		(error 4)
   	succ(0.0, Y).		(error 5)
   	succ(a, Y).		(error 24)
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/arithmetic/plus-3.html">plus / 3</A>, <A HREF="../../kernel/arithmetic/P-3.html">+ / 3</A>, <A HREF="../../kernel/arithmetic/--3.html">- / 3</A>
</BODY></HTML>
